package ch5;

import java.util.Scanner;

public class Zxf16 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int b = 0;
        int c = 0;
        int a = in.nextInt();
        while ((a % 10 == 0 || a % 10 != 0)&&a>=1) {
            b = a % 10;
            a = a / 10;
            c = c + b;
            // System.out.println(c);
        }
        System.out.println(c);
    }
}
